package sort;

import java.util.*;

/**
 * @author XY
 * @version 1.0
 * @date 2022/2/14 9:22
 * @Description
 */
public class Leet268 {

    public static int missingNumber(int[] nums) {
        Set<Integer> list = new HashSet<>();
        for (int num : nums) {
            list.add(num);
        }
        for(int i =0;i<list.size()+1;i++){
            if(!list.contains(i)){
                return i;
            }
        }
        return -1;
    }



    public static void main(String[] args) {
        int[] arr= {0,1};
        System.out.println(missingNumber((arr)));
    }
}
